<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="com.ejoysoft.wlanyz.business.HotSpot,com.ejoysoft.common.Constants,com.ejoysoft.util.ParamUtil"%>
<%@ include file="../include/jsp/head.jsp"%>
<%
try{
    HotSpot obj=new HotSpot(globa,true);
    String strUrl="hot_list.jsp";
    String strId=ParamUtil.getString(request,"strId","");
   
    if(action.equals(Constants.DELETE_STR)){
    	//System.out.println(action+"aaaaaaaaa");
    	String[] aryStrId = ParamUtil.getStrArray(request, "strId");
    	
    	for (int i = 0; i < aryStrId.length; i++) {
	    	obj.delete("where strId ='"+aryStrId[i]+"'",strId);
	    	
    	}
    	globa.dispatch(true, strUrl);
	} else {
	    if(action.equals(Constants.ADD_STR)) {
	    	String strCity=ParamUtil.getString(request,"strCity","");
		    String strTown=ParamUtil.getString(request,"strTown","");
			String strClassOneHP=ParamUtil.getString(request,"strClassOneHP","");
		    String strHotPotName=ParamUtil.getString(request,"strHotPotName","");
	  
            if(obj.getCount(" where strCity='" + strCity.replaceAll(" ","") + "' and  strTown='" + strTown.replaceAll(" ","") + "' and  strClassOneHP='" + strClassOneHP.replaceAll(" ","") + "' and strHotPotName='" + strHotPotName.replaceAll(" ","") + "' ")>0){
                globa.closeCon();
                out.print("<script>alert('已经存在热点:"+strHotPotName.replaceAll(" ","")+", 请输入其他热点');window.location.href = 'hot_add.jsp';</script>");
                
                
             }else{ 
          
            globa.dispatch(obj.add(strHotPotName),strUrl);
            	    
		}
		}
		else if(action.equals(Constants.UPDATE_STR)){

   
             if(strUrl.indexOf(".jsp")>=0)
                 strUrl=strUrl+"?strId="+strId;
                 
                 globa.dispatch(obj.update(strId),strUrl);
                 //System.out.println(strUrl+"aaaaaaaaa222222222222222");
      }
    // System.out.println(action+"aaaaaaaaa=============");
	}
    //关闭数据库连接对象
    globa.closeCon();
    }catch(Exception e){e.printStackTrace();}
%>